package com.beidouapp.dao.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.RowBounds;

import com.beidouapp.dao.BaseDao;
import com.beidouapp.mapper.BaseMapper;

public abstract class BaseDaoImpl<T> implements BaseDao<T> {

    public abstract BaseMapper<T> getResourceMapper();

    @Override
    public T getEntryByID(Long id) {
        return getResourceMapper().getEntryByID(id);
    }

    @Override
    public List<T> findEntryList(T entry) {
        return getResourceMapper().findEntryList(entry);
    }

    @Override
    public long findEntryCount(T entry) {
        return getResourceMapper().findEntryCount(entry);
    }

    @Override
    public List<T> findEntryListByMap(Map<String, Object> paramters) {
        return getResourceMapper().findEntryListByMap(paramters);
    }

    public List<T> findEntryListByMap(Map<String, Object> paramters, Integer offset, Integer limit) {
        return getResourceMapper().findEntryListByMap(new RowBounds(offset, limit), paramters);
    }

    @Override
    public long findEntryCountByMap(Map<String, Object> paramters) {
        return getResourceMapper().findEntryCountByMap(paramters);
    }

    @Override
    public int addEntry(T entry) {
        return getResourceMapper().addEntry(entry);
    }

    @Override
    public int removeEntryByID(Long id) {
        return getResourceMapper().removeEntryByID(id);
    }

    @Override
    public int removeEntryByMap(Map<String, Object> paramters) {
        return getResourceMapper().removeEntryByMap(paramters);
    }

    @Override
    public int removeEntry(T entry){
        return getResourceMapper().removeEntry(entry);
    }

    @Override
    public int removeEntryBatch(List<Long> idList){
        return getResourceMapper().removeEntryBatch(idList);
    }

    @Override
    public int modifyEntry(T entry) {
        return getResourceMapper().modifyEntry(entry);
    }

    @Override
    public int addEntryBatch(List<T> entryList){
        return getResourceMapper().addEntryBatch(entryList);
    }
}
